/*
 * @Description: 
 * @Author: zoe
 * @Date: 2024-09-20 20:01:34
 * @LastEditors: rendc
 * @LastEditTime: 2024-09-20 20:01:34
 */
public class StringComparison {
    public static void main(String[] args) {
        String str1 = "hello";
        String str2 = "hello";
        String str3 = new String("hello");
        String str4 = new String("hello");
        String str5 = "hellohello";
        String str6 = str1 + str2;
        
        System.out.println(str1 == str2);      // true
        System.out.println(str2 == str3);      // false
        System.out.println(str3 == str4);      // false
        System.out.println(str2.equals(str3)); // true
        System.out.println(str3.equals(str4)); // true
        System.out.println(str5.equals(str6)); // true
        System.out.println(str5 == str6);      // false
    }
}